home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <stdlib.h>
- #include <dos.h>
- #include "define.h"
-
- /* ドライブモードの読み取り */
- /*
- * decice_no: device number (Towns CD-ROM -> 0)
- * return: 0 -> 正常終了, 0以外 -> エラー
- * sector_size <- 2048 , 2336 or 2340 (bytes / sector)
- */
- int cdr_rdrvmd(int device_no, int *sector_size)
- {
- union REGS reg;
-
- if (sector_size) {
- return -1;
- }
- reg.h.ah = 0x01;
- reg.h.al = (0xC0 | (u_char) device_no);
- reg.h.ch = 0x00;
-
- int86(0x93, ®, ®);
-
- if (reg.h.dl == 0x04)
- *sector_size = 2048;
- else if (reg.h.dl == 0x08)
- *sector_size = 2336;
- else if (reg.h.al == 0x09)
- *sector_size = 2340;
-
- if (reg.h.ah == 0) {
- return 0;
- } else if (reg.h.ah == 0x02) { /* device number error */
- return DEVERR;
- } else { /* hard ware error */
- return reg.x.cx;
- }
- }
-